﻿using NUnit.Framework;
using StoryQ;
using TripleA.StoryQ;

namespace TripleA.Tests.Process
{
    [TestFixture]
    public class ProcessTests : BddFeature
    {
        protected override Feature DescribeFeature()
        {
            return new Story("Testing the process extensions")
                .InOrderTo("Interact with processes")
                .AsA("system test")
                .IWant("triplea extensions to handle this for me");
        }

        [Test]
        public void CheckApplicationIsRunning()
        {
            using (var domain = new ProcessDomain())
            {
                Feature.WithScenario("Ensure that an application is running")
                    .Given(domain.TheExeNamed_, "notepad.exe")
                    .When(domain.TheExeIsLaunched)
                    .Then(domain.TheExeShouldBeRunning)
                    .ExecuteWithReport();
            }
        }

        [Test]
        public void CheckApplicationIsNotRunning()
        {
            using (var domain = new ProcessDomain())
            {
                Feature.WithScenario("Ensure that an application is not running")
                    .Given(domain.TheExeNamed_, "2324wrwr.exe")
                    .When(domain.TheExeIsLaunched)
                    .Then(domain.TheExeShouldNotBeRunning)
                    .ExecuteWithReport();
            }
        }
    }
}